
package org.dromara.system.api.services;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.AssertUtils;
import org.dromara.system.api.feign.SystemPostClient;
import org.dromara.system.api.feign.SystemRoleClient;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author: zhou shuai
 * @date: 2024/10/6 10:52
 * @version: v1
 */
@Slf4j
@Service("sysPostApiService")
@RequiredArgsConstructor
public class SysPostApiService {

    private final SystemPostClient systemPostClient;

    /**
     * 根据岗位 ID 列表查询岗位名称映射关系
     *
     * @param postIds 岗位 ID 列表
     * @return Map，其中 key 为岗位 ID，value 为对应的岗位名称
     */
    public Map<Long, String> selectPostNamesByIds(List<Long> postIds) {
        R<Map<Long, String>> postNameListResult = systemPostClient.selectPostNamesByIds(postIds);
        AssertUtils.assertTrue(R.isSuccess(postNameListResult), "根据岗位ID集合查询岗位名称映射关系失败");
        return postNameListResult.getData();
    }

}
